import request from '@/utils/request_1'

// 新增盘点清单
export const addCheckTask = (params: any) =>
  request({
    url: '/checkTask',
    method: 'post',
    data: { ...params }
  })

// 修改盘点任务
export const updateCheckTask = (params: any) =>
  request({
    url: '/checkTask',
    method: 'put',
    data: { ...params }
  })

// 删除盘点任务
export const deleteCheckTask = (params: any) =>
  request({
    url: '/checkTask',
    method: 'delete',
    params
  })

// 盘点完成
export const finishCheckTask = (params: any) =>
  request({
    url: '/checkTask/complete',
    method: 'put',
    data: params
  })

// 分配
export const distributeCheckTask = (params: any) =>
  request({
    url: '/checkTask/distribute',
    method: 'put',
    data: { ...params }
  })

// 生成损益单
export const createLoseProfit = (params: any) =>
  request({
    url: '/checkTask/increaseDecrease',
    method: 'post',
    data: params
  })

// 查询全部盘点任务
export const findAllCheckTask = (params: any) =>
  request({
    url: '/checkTask/list',
    method: 'get',
    params
  })

// 分页查询盘点任务
export const findCheckTaskPaging = (params: any) =>
  request({
    url: '/checkTask/page',
    method: 'get',
    params
  })

// 分页查询盘点任务明细
export const findCheckTaskDetailPaging = (params: any) =>
  request({
    url: '/checkTask/pageDetail',
    method: 'get',
    params
  })

// 生成复盘任务
export const createDoubleCheckTask = (params: any) =>
  request({
    url: '/checkTask/task',
    method: 'post',
    data: params
  })

// 查询盘点任务
export const findOneCheckTask = (id: number) =>
  request({
    url: `/checkTask/${id}`,
    method: 'post'
  })
